Skip to content

[67724] Make breadcrumbs optional in page header component - #376

Merged
bsatarnejad merged 23 commits into
mainfrom
67724-change-page-header-component
Nov 5, 2025
Merged

[67724] Make breadcrumbs optional in page header component#376
bsatarnejad merged 23 commits into
mainfrom
67724-change-page-header-component

Conversation

@bsatarnejad

@bsatarnejad bsatarnejad commented Oct 24, 2025

Copy link
Copy Markdown

What are you trying to accomplish?

Make the breadcrumbs in page header component optional

Screenshots

page header without breadcrumbs

Closes https://community.openproject.org/wp/67724

Risk Assessment

  • Low risk the change is small, highly observable, and easily rolled back.
  • Medium risk changes that are isolated, reduced in scope or could impact few users. The change will not impact library availability.
  • High risk changes are those that could impact customers and SLOs, low or no test coverage, low observability, or slow to rollback.

…ontext bar only if there are anything in it to be shown
@changeset-bot

changeset-bot Bot commented Oct 24, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a8ddab6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@openproject/primer-view-components Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actions Bot commented Oct 24, 2025

Copy link
Copy Markdown

⚠️ Visual or ARIA snapshot differences found

Our visual and ARIA snapshot tests found UI differences. Please review the differences by viewing the files changed tab to ensure that the changes were intentional.

Review differences

Comment thread app/components/primer/open_project/page_header.html.erb Outdated
Comment thread app/components/primer/open_project/page_header.rb Outdated
Comment thread app/components/primer/open_project/page_header.rb Outdated
Comment thread app/components/primer/open_project/page_header.rb
Comment thread previews/primer/open_project/page_header_preview.rb Outdated
Comment thread previews/primer/open_project/page_header_preview.rb Outdated
@bsatarnejad
bsatarnejad requested a review from HDinger October 28, 2025 07:20

@HDinger HDinger left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you check locally in core whether the spacing matches so that the title of a PageHeader without breadcrumb is at the same height as the breadcrumb on other pages? I want to avoid special alignments for the menu button when there is no breadcrumb. Also, it would create visual jumps when navigating between pages.

Comment thread app/components/primer/open_project/page_header.html.erb Outdated
# @param items [Array<String, Hash>] Items is an array of strings, hash {href, text} or an anchor tag string
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
renders_one :breadcrumbs, lambda { |items, selected_item_font_weight: :bold, **system_arguments|
renders_one :breadcrumbs, lambda { |items = nil, selected_item_font_weight: :bold, **system_arguments|

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with the default provided, nothing forces other devs to actually think about the breadcrumb. You can call

        render(Primer::OpenProject::PageHeader.new) do |header|
          header.with_title { "Hello" }
        end

and it would be valid. Since in most cases we want a breadcrumb, we have to enforce that stronger. Please remove the default, so that the caller has to explicitly set nil if he/she wants to make an exception.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not valid, it returns an error:
PageHeader needs a title and a breadcrumb. Please use the with_title and with_breadcrumbs slot

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd nevertheless prefer it to be set explicitly. Having to use an empty slot which renders nothing in the end, feels weird.
So I'd prefer with_breadcrumbs(nil)

Comment thread .changeset/thin-terms-shout.md Outdated
Comment thread app/components/primer/open_project/page_header.rb Outdated
Comment thread test/components/primer/open_project/page_header_test.rb Outdated
Comment thread test/components/primer/open_project/page_header_test.rb Outdated
Comment thread test/components/primer/open_project/page_header_test.rb
Comment thread previews/primer/open_project/page_header_preview.rb

@HDinger HDinger left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍 I only have small remarks left

Comment thread previews/primer/open_project/page_header_preview.rb
Comment on lines +87 to +96
.PageHeader--noBreadcrumb .PageHeader-contextBar {
display: none;
}

/* Keep it visible on smaller */
@media (max-width: 543.98px) {
.PageHeader--noBreadcrumb .PageHeader-contextBar {
display: flex;
}
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.PageHeader--noBreadcrumb .PageHeader-contextBar {
display: none;
}
/* Keep it visible on smaller */
@media (max-width: 543.98px) {
.PageHeader--noBreadcrumb .PageHeader-contextBar {
display: flex;
}
}
/* Hide the context bar on desktop when no breadcrumb is visible */
@media screen and (min-width: $breakpoint-sm) {
.PageHeader--noBreadcrumb .PageHeader-contextBar {
display: none;
}
}

}

.PageHeader--noBreadcrumb .PageHeader-titleBar {
height: var(--control-small-size);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was probably done for the alignment with the menu button? Could you please add a comment for that? Otherwise, it is weird to understand later.

@bsatarnejad
bsatarnejad requested a review from HDinger November 4, 2025 14:39
@bsatarnejad
bsatarnejad merged commit 908eee6 into main Nov 5, 2025
25 of 30 checks passed
@openprojectci openprojectci mentioned this pull request Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants